-
-
Notifications
You must be signed in to change notification settings - Fork 558
Add limit to subfolders not to overwhelm the context #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds documentation in src/server.ts about context overflow protection for ListDirectory. Implements a cap in src/tools/filesystem.ts to limit items shown for nested directories to 100, adds warnings when items are hidden, and updates recursive traversal to distinguish top-level vs nested calls. No public APIs changed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Server
participant Filesystem as listDirectory
participant Helper as listRecursive
User->>Server: Request directory listing
Server->>Filesystem: listDirectory(path, depth)
Filesystem->>Helper: listRecursive(path, depth, prefix, isTopLevel=true)
alt Top-level directory
Helper->>Helper: Read all entries (no cap)
else Nested directory
Helper->>Helper: Read entries\nIf count > 100, slice to first 100
Note right of Helper: Append "[WARNING] ... X hidden of Y total"
end
loop For each subdirectory
Helper->>Helper: listRecursive(subdir, depth-1, newPrefix, isTopLevel=false)
end
Helper-->>Filesystem: Formatted listing (with optional warnings)
Filesystem-->>Server: Result
Server-->>User: Response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code graph analysis (1)src/tools/filesystem.ts (1)
🔇 Additional comments (9)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary by CodeRabbit
New Features
Documentation